package cn.tedu.boot41.controller;


import cn.tedu.boot41.Mapper.UserMapper;
import cn.tedu.boot41.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    UserMapper mapper;
    @RequestMapping("/reg")
    public int reg(@RequestBody User user){
        System.out.println("user = " + user);

        User u = mapper.selectByUsername(user.getUsername());
        if (u!=null){
            return 2;
        }
        return 1;
    }
}
